import request from "@/utils/request";
// 模型创建-----------------------------------------------------
// 创建量化模型
export function getInitFemaInfo(params) {
  return request({
    url: "/health/getInitFemaInfo",
    method: "get",
    params,
  });
}
// 新增应用
export function deleteModelConfig(data) {
  return request({
    url: "/health/deleteModelConfig",
    method: "post",
    data: data,
  });
}
// 对应设备健康因子
export function getHealthFactorTree(params) {
  return request({
    url: "health/getHealthFactorTree",
    method: "get",
    params,
  });
}
// 可绑定测点
export function getPointListByDeviceCode(deviceCode) {
  return request({
    url: "/point/getPointListByDeviceCode?deviceCode=" + deviceCode,
    method: "get",
  });
}

// 模型创建
export function saveAssessModel(data) {
  return request({
    url: "/health/saveAssessModel",
    method: "post",
    data: data,
  });
}
// 模型维护---------------------------------------
// 删除应用
export function delModelBasic(id) {
  return request({
    url: "/forecast/forecastModelBasic/" + id,
    method: "delete",
  });
}
// 模型列表
export function forecastModelBasic(data) {
  return request({
    url: "/forecast/forecastModelBasic/list",
    method: "get",
    params: data,
  });
}
// 模型列表
export function getHealthModelList(data) {
  return request({
    url: "/health/getHealthModelList",
    method: "get",
    params: data,
  });
}

//   模型详细信息
export function getHealthModelInfo(data) {
  return request({
    url: "/health/getHealthModelInfo",
    method: "get",
    params: data,
  });
}
// 获取因子列表
export function getFactorList(data) {
  return request({
    url: "/health/getFactorList",
    method: "get",
    params: data,
  });
}
// 一致性检验
export function labCalc(data) {
  return request({
    url: "/health/labCalc",
    method: "post",
    data: data,
  });
}
// 维护创建量化模型
export function getNonInitFemaInfo(data) {
  return request({
    url: "/health/getNonInitFemaInfo",
    method: "post",
    data,
  });
}

//  模型更新
export function updateAssessModel(data) {
  return request({
    url: "/health/updateAssessModel",
    method: "post",
    data,
  });
}

// 设备评估----------------
// 配置信息
export function getDeviceModelInfoList() {
  return request({
    url: "/health/getDeviceModelInfoList",
    method: "get",
  });
}
//  模型配置保存
export function saveModelConfig(data) {
  return request({
    url: "/health/saveModelConfig",
    method: "post",
    data,
  });
}

// 手动健康评估
export function executeHealthAssess() {
  return request({
    url: "/health/executeHealthAssess",
    method: "get",
  });
}
// 获取各系统健康状况,模块设备：3，子系统：2，dcs系统：1
export function getDeviceLatestRecordByLevel(deviceLevel) {
  return request({
    url:
      "/healthRecord/getDeviceLatestRecordByLevel?deviceLevel=" + deviceLevel,
    method: "get",
  });
}
// 自动评估
//  自动评估查询
export function autoList() {
  return request({
    url: "/monitor/job/list?pageNum=1&pageSize=10&jobName=开始健康评估",
    method: "get",
  });
}
// 开始评估 停止评估
// "jobId": xxx,
// "status": "0" // 0：开始健康评估，1：停止健康
export function changeStatus(data) {
  return request({
    url: "/monitor/job/changeStatus",
    method: "put",
    data,
  });
}

// 评估结果展示----------------------------------
// 查询
// deviceId(非必传，不传查询所有)
export function getLatestRecord() {
  return request({
    url: "/healthRecord/getLatestRecord",
    method: "get",
  });
}
// 柱状图右侧查询某设备历史趋势图
// deviceId,startTime(非必传)，endTime(非必传)，默认查询24小时内的
export function getHistoryData(data) {
  return request({
    url: "/healthRecord/getHistoryData",
    method: "get",
    params: data,
  });
}
